package com.pig4cloud.pig.admin.constant;

import okhttp3.Credentials;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class EMQXNodesAPIExample {
    public static void main(String[] args) {
        try {
            String username = "b719607226d34094";
            String password = "gGG8TTNpTK4738r1A5LxQajh2d5IcOrEoKhSxGrQcPB";

			List<String>  a = new ArrayList<>();
			a.add("1");
            OkHttpClient client = new OkHttpClient();

            Request request = new Request.Builder()
                    .url("http://127.0.0.1:18083/api/v5/clients?clientid=a,b&limit=20&page=1")
                    .header("Content-Type", "application/json")
                    .header("Authorization", Credentials.basic(username, password))
                    .build();

            Response response = client.newCall(request).execute();
            System.out.println(response.body().string());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}